package com.liachen.stock.entity.etf;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import java.util.Date;

/**
 * ETF 简要信息
 *
 * @author d85v8h9 chen.liang
 * @date 2021/12/25 8:49
 * @since V1.0
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class EtfBrief {

    private String etfStockCode;
    @ToString.Exclude
    private String indexId;

    private String etfName;

    private String stockCode;

    private String name;
    @ToString.Exclude
    private Date launchDate;
    @ToString.Exclude
    private Double oneYearClosePointChange;
    @ToString.Exclude
    private Double threeYearClosePointChange;
    @ToString.Exclude
    private Double fiveYearClosePointChange;
    @ToString.Exclude
    private String description;
    @ToString.Exclude
    private Double pe;
    private Double pePos;
    @ToString.Exclude
    private Double pb;
    private Double pbPos;
    @ToString.Exclude
    private Double ps;
    private Double psPos;
    @ToString.Exclude
    private Double roe;

    private Double avgPos;

    public Double getAvgPos() {
        return (this.getPePos() + this.getPbPos()) / 2;
    }

    public Boolean isTooLow() {
        return this.getAvgPos() < 10;
    }

    public Boolean isLow() {
        return this.getAvgPos() >= 10 && this.getAvgPos() < 35;
    }

    public Boolean isNormal() {
        return this.getAvgPos() >= 35 && this.getAvgPos() < 65;
    }

    public Boolean isHigh() {
        return this.getAvgPos() >= 65;
    }
}
